package com.banban.user.controller;

import com.banban.user.dto.SavePrologueDTO;
import com.banban.user.service.UserPrologueService;
import com.banban.user.vo.DataResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * @author 张振飞
 * @Package com.banban.user.controller
 * @date 2025/4/19 11:36
 */
@RequestMapping("/prologue")
@RestController
@Slf4j
public class PrologueController {

    @Autowired
    private UserPrologueService prologueService;


    /**
     * 设置开场白接口
     * @return
     */
    @PostMapping("/save")
    public DataResult setPrologue(@RequestBody @Valid SavePrologueDTO dto) {
        log.info("设置开场白接口，入参：{}",dto);
        prologueService.setPrologue(dto);
        return DataResult.success();
    }

    /**
     * 获取当前配置的开场白信息
     * @return
     */
    @GetMapping("/get")
    public DataResult getPrologue() {
        log.info("获取当前配置的开场白信息接口");
        String prologue = prologueService.getPrologue();
        return DataResult.success(prologue);
    }
}
